package spark.sql

import java.util

/**
  * Created by liuwei on 2017/9/1.
  */
object Test2222 {
  var FEATURE_VALUE = "feature_value"
  var FEATURE_NAME = "feature_name"
  var index: Int = 0
  def main(args: Array[String]): Unit = {

    val titleNames = List("feature_name", "feature_name_1")
    //    titleNames.addString("feature_name");
    //    titleNames.addString("feature_name_1");
//    println(getNewColumn(titleNames));

    println(ColumnUtils.getNotExistNameByArray(FEATURE_NAME,titleNames))
    println(ColumnUtils.getNotExistNameByArray(FEATURE_VALUE,titleNames))


    def getNewColumn(titleNames: List[String]): Int = {
      //      var index :Int= 0
      if (titleNames.contains(FEATURE_NAME)) {
        index += 1
        FEATURE_NAME = FEATURE_NAME + "_" + index
        getNewColumn(titleNames)
      } else {
        index
      }
    }
  }

}